package com.lrs.s2sh.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Generic DAO (Data Access Object) with common methods to CRUD POJOs.
 * 
 * <p>
 * Extend this interface if you want typesafe (no casting necessary) DAO's for
 * your domain objects.
 * 
 * @author Michael
 * @param <T>
 *            a type variable
 * @param <PK>
 *            the primary key for that type
 */
public interface GenericDao<T, PK extends Serializable> {

	List<T> getAll();

	List<T> getAllDistinct();

	T get(PK id);

	boolean exists(PK id);

	T save(T object);

	void remove(PK id);

	List<T> findByHql(String hql);

	List<T> findByProperty(String propertyName, Object value);

	List<T> findByNamedQuery(String queryName, Map<String, Object> queryParams);
}